$def with (ogtxml, knowinfo, kinfo, resinfo)
$ nofiles = ['PlainText', 'FormalizedText', 'FormattedText', 'Demonstration']
$ allfiles = ['Image', 'Audio', 'Video']
$ allforms = ogtxml.getResourceForms(knowinfo.knowledge)
$ nofilesspe = [k for k in nofiles if k in allforms.keys()]
$ allfilesspe = [k for k in allfiles if k in allforms.keys()]

<div role="article" class="coursera-body">
	<div class="container">
		<div class="coursera-full-canvas">
			<div class="row-fluid">
				<div class="span12">
					<div style="margin-bottom: 10px;" class="heading-banner">
						<h1>Reusing of $knowinfo.knowledge:$knowinfo.name<small id="coursera-profile-editor-status"
								style="font-size: 12px; line-height: 12px;"></small>
						</h1>
					</div>
				</div>
			</div>
			<div class="row-fluid">
				<div class="span12">
					<div>
						<h3>Annotations</h3><br/>
					</div>
					<form id="coursera-profile-editor-form"
						action="/reuse"
						enctype="multipart/form-data" method="POST"
						class="form-horizontal">
						<input type="hidden" name="knowid" value="$kinfo.knowid">
						<div class="control-group">
							<label class="control-label">Name</label>
							<div class="controls"><input type="text" name="Name" value="$kinfo.Name"></div>
						</div>
						$for i,j in ogtxml.getAnnotationForms(knowinfo.knowledge).items():
							$if not i == "Name":
								<div class="control-group">
								<label class="control-label">$i</label>
								<div class="controls">
								$ val = kinfo.get(i)
								$if j == "text":
									<input type="text" name="$i" value="$val">
								$elif j == "textarea":
									<textarea name="$i" style="width: 600px;" class="large">$val</textarea>
								</div>
								</div>
						<br/>
						$if nofilesspe != []:
							<hr class="coursera-full-page-divider-no_padding">
						$for m in nofilesspe:
							$ n=allforms.get(m)
							<div><h3>$m</h3><br/></div>
							$if m in resinfo.keys():
								$ res = resinfo.get(m)[0]
								<div class="control-group"><div class="controls" style="width:600px;">
								<p>$:res.resource</p>
								<a tabindex="0" class="nofiles-popup" data-popup-obj="popup_$m" data-open="0"><span>edit this $m</span><span>&nbsp;▾</span></a>
								</div></div>
								<div class="" style="display:none;" id="popup_$m">
								$if m == "FormattedText":
									<input type="hidden" name="change$m" value="0" id=change$m>
								$else:
									<input type="hidden" name="change$m" value="$res.id" id=change$m>
								$for i,j in n.items():
									$ val = res.get(i, '')
									<div class="control-group">
									<label class="control-label">$i</label>
									<div class="controls change-flag-parent" data-change-obj="change$m">
									$if j == "text" or j == "datetime" or j == "int":
										<input type="text" name="$m$i" value="$val">
									$elif j == "textarea":
										$if m == "FormattedText":
											<textarea name="$m$i" style="width: 600px;" class="ckeditor">$val</textarea>		
										$else:
											<textarea name="$m$i" style="width: 600px;" class="large">$val</textarea>
									$elif j == "file":
										<input type="file" name="$m$i" class="image-selector-input">
									$elif j == "option":
										<select name="$m$i" style="width: 120px;">
											$for k in ogtxml.equivalentOptions(i):
												$if k == val:
													<option value="$k" selected="selected">$k</option>
												$else:
													<option value="$k">$k</option>
										</select>
									</div>
									</div>
								</div>
								<br/>
							$else:
								<div class="control-group"><div class="controls" style="width:600px;">
								<p>this version has no resource $m</p>
								<a tabindex="0" class="nofiles-popup" data-popup-obj="popup_$m" data-open="0"><span>add your $m</span><span>&nbsp;▾</span></a>
								</div></div>
								<div class="" style="display:none;" id="popup_$m">
									<input type="hidden" name="change$m" value="0">
								$for i,j in n.items():
									<div class="control-group">
									<label class="control-label">$i</label>
									<div class="controls">
									$if j == "text" or j == "datetime" or j == "int":
										<input type="text" name="$m$i">
									$elif j == "textarea":
										$if m == "FormattedText":
											<textarea name="$m$i" style="width: 600px;" class="ckeditor"></textarea>		
										$else:
											<textarea name="$m$i" style="width: 600px;" class="large"></textarea>
									$elif j == "file":
										<input type="file" name="$m$i" class="image-selector-input">
									$elif j == "option":
										<select name="$m$i" style="width: 120px;">
											$for k in ogtxml.equivalentOptions(i):
												<option value="$k">$k</option>
										</select>
									</div>
									</div>
								</div>
								<br/>
						$if allfilesspe != []:
							<hr class="coursera-full-page-divider-no_padding">
						$for m in allfilesspe:
							$ n=allforms.get(m)
							<div><h3>$m</h3><br/></div>
							<div class="control-group"><div class="controls" style="width:600px;">
							$if m in resinfo.keys():
								$for i in resinfo.get(m):
									<div>
									$if m == "Image":
										<img src="$i.localPath" width="300" height="300">
										<p class="change-$m" data-type="$m" data-type-id="$i.id">
											<img src="/static/images/dui50.jpg">
											<a  class="change-all-select" data-select="1"><span>delete this $m</span></a>
										</p>
									$elif m == "Audio":
										<embed src="$i.localPath" autoplay="false" autostart="false" controls="console" align="texttop" width="300" height="60" alt="Your browser does not support the audio tag">
										</embed>
										<p class="change-$m" data-type="$m" data-type-id="$i.id">
											<img src="/static/images/dui50.jpg">
											<a  class="change-all-select" data-select="1"><span>delete this $m</span></a>
										</p>
									$elif m == "Video":
										$if i.VideoFormat == "FLV":
											<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0"
												width="500" height="400">
												<param name="movie" value="$i.localPath" />
												<param name="salign" value="lt" />
												<param name="quality" value="high" />
												<param name="flashvars" value="" />
												<embed src="$i.localPath" quality="high" flashvars=""
													scale="noscale" width="500" height="400" salign="LT" type="application/x-shockwave-flash"
													pluginspage="http://www.macromedia.com/go/getflashplayer" />
											</object>
											<p class="change-$m" data-type="$m" data-type-id="$i.id">
												<img src="/static/images/dui50.jpg">
												<a  class="change-all-select" data-select="1"><span>delete this $m</span></a>
											</p>
										$elif i.VideoFormat == "AVI" or i.VideoFormat == "DivX":
											<object type="video/x-msvideo" data="$i.localPath"  width="500" height="400">
												<param name="src" value="$i.localPath" />
												<param name="autostart" value="false" />
												<param name="controller" value="true" />
											</object> 
											<p class="change-$m" data-type="$m" data-type-id="$i.id">
												<img src="/static/images/dui50.jpg">
												<a  class="change-all-select" data-select="1"><span>delete this $m</span></a>
											</p>
										$elif i.VideoFormat == "MPEG" or i.VideoFormat == "OGG" or i.VideoFormat == "WEBM":
											<video controls="controls" width="500" height="400">
												<source src="$i.localPath" type="video/mp4" />
												<source src="$i.localPath" type="video/webm" />
												<source src="$i.localPath" type="video/ogg" />
											</video>
											<p class="change-$m" data-type="$m" data-type-id="$i.id">
												<img src="/static/images/dui50.jpg">
												<a  class="change-all-select" data-select="1"><span>delete this $m</span></a>
											</p>
										$else:
											<video src="$i.localPath" controls="controls" width="500" height="400">
											</video>
											<p class="change-$m" data-type="$m" data-type-id="$i.id">
												<img src="/static/images/dui50.jpg">
												<a  class="change-all-select" data-select="1"><span>delete this $m</span></a>
											</p>
									</div><br/>
							$else:
								<p>this version has no resource $m</p>
							<a tabindex="0" class="nofiles-popup" data-popup-obj="popup_$m" data-open="0"><span>add your $m</span><span>&nbsp;▾</span></a>
							</div></div>
							<div class="" style="display:none;" id="popup_$m">
							<input type="hidden" name="change$m" value="0" id="change$m">
							$for i,j in n.items():
								<div class="control-group">
								<label class="control-label">$i</label>
								<div class="controls">
								$if j == "text" or j == "datetime" or j == "int":
									<input type="text" name="$m$i">
								$elif j == "textarea":
									$if m == "FormattedText":
										<textarea name="$m$i" style="width: 600px;" class="ckeditor"></textarea>		
									$else:
										<textarea name="$m$i" style="width: 600px;" class="large"></textarea>
								$elif j == "file":
									<input type="file" name="$m$i" class="image-selector-input">
								$elif j == "option":
									<select name="$m$i" style="width: 120px;">
										$for k in ogtxml.equivalentOptions(i):
											<option value="$k">$k</option>
									</select>
								</div>
								</div>
							</div>
							<br/>
						<div class="control-group">
							<div class="controls">
								<button type="submit"
									class="coursera-save-button btn btn-primary">Save Your Change</button>
							</div>
						</div>
						<input type="hidden" name="lev1" value="1">
						<input type="hidden" name="know" value="$knowinfo.knowledge">
					</form>
				</div>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
window.onload=reuse_onload;
</script>